<template>
	<view class="out">
		<input type="text" @confirm="onConfirm" v-model="iptValue"  @focus="isActive = true" @blur="isActive = false"/>
		<image class="pic" src="../../static/dongtu.gif" mode="" :class="isActive? 'active':''"></image>
	</view>
	
	<view class="">
		预览：{{iptValue}}
	</view>
</template>

<script setup>
import { ref } from 'vue';
const iptValue = ref("请输入...");
const isActive = ref(false);

function onConfirm(e){
	console.log(e.detail.value)
}
</script>

<style lang="scss" scoped>
.out{
	padding: 0 20px;
	margin-top: 40px;
	position: relative;
	input{
		border: 1px solid #ccc;
		height: 40px;
		position: relative;
		z-index: 2;
		background: #fff;
		padding: 0 10px;
	}
	.pic{
		width: 24px;
		height: 24px;
		z-index: 1;
		position: absolute;
		top: 0;
		left: calc(50% - 12px);
		transition: top 0.3s;
	}
	.pic.active{
		top:-24px;
	}
}
</style>
